import Util

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app, login_required
from google.appengine.ext.deferred import defer
from Pos import *

class Importer(Util.BaseRequestHandler):
	@login_required
	def get(self):
		template_values = {}
		if self.request.get('urlError') and len(self.request.get('m')) > 0:
			template_values['message'] = self.request.get('m')
		self.generate('importer-start.html', template_values)

	def post(self):
		requestUrl = self.request.get()
		if len(requestUrl) > 0:
			self.generate('base.html',
				{'message': 'Importer Started'})
		else:
			self.redirect('/importer?m=' + url)
		
application = webapp.WSGIApplication([
		('/importer', Importer)
	],
	debug=True)

def main():
	run_wsgi_app(application)

if __name__ == "__main__":
	main()
